package com.decent.manager.system.auth.vo;

import com.decent.common.enums.manager.MenuTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * 页面获取登录信息（含导航）
 *
 * @className: LoginData
 * @author: wangyan
 * @date: 2022/4/16
 **/
@Data
public class LoginData implements Serializable {
    private static final long serialVersionUID = -1535592965379718128L;
    private String name;
    private String roleName;
    private LoginPermissionVO permissionTreeVO;

    public LoginPermissionVO getPermissionTreeVO() {
        return permissionTreeVO == null ? new LoginPermissionVO() : permissionTreeVO;
    }

    /**
     * 登录权限视图对象
     */
    @Data
    public static class LoginPermissionVO implements Serializable {
        private static final long serialVersionUID = 5525990524433801216L;
        private Integer total;
        private List<NavigatorVO> rows;
    }

    /**
     * 登录导航视图对象
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class NavigatorVO implements Serializable {
        private static final long serialVersionUID = 251240575560059907L;
        private Long id;
        private String functionName;
        private MenuTypeEnum type;
        private Long parentId;
        private Integer sort;
        private String url;
        private Boolean selected;
        private String icon;
        private Boolean visibility;
    }
}
